use "C:\Estimated Energy Use mtoe.dta"
gen iso31=iso3
sort iso31
save "C:\z1",replace

use "C:\hydro access"
gen iso31=iso3
sort iso31
save "C:\z2",replace

use "C:\coal access"
sort iso31
save "C:\z3",replace

use "C:\oil access"
sort iso31
save "C:\z4",replace

use "C:\gas access"
sort iso31
save "C:\z5",replace
merge iso31 using "C:\z4"
drop _merge
sort iso31
merge iso31 using "C:\z3"
drop _merge
sort iso31
merge iso31 using "C:\z2"
drop _merge
sort iso31
merge iso31 using "C:\z1"
drop _merge
drop iso3
rename iso31 iso3
format enumtoe owncoal wgtcoal ownoil wgtoil owngas wgtgas ownhydro wgthydro %7.1f
drop if owncoal==.
replace iso3="COD" if iso3=="ZAR"
replace iso3="ROU" if iso3=="ROM"
keep country1 iso3 enumtoe owncoal wgtcoal ownoil wgtoil owngas wgtgas ownhydro wgthydro
sort iso3
save "C:\Energy Access",replace



